﻿<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!--
Beyond Admin - Responsive Admin Dashboard Template build with Twitter Bootstrap 3
Version: 1.0.0
Purchase: http://wrapbootstrap.com
-->

<html xmlns="http://www.w3.org/1999/xhtml">
<!--Head-->
<head>
<meta charset="utf-8" />
<title>管理员修改教师用户信息</title>

<meta name="description" content="register page" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon"
	href="<%=request.getContextPath()%>/commonadmin/assets/img/favicon.png"
	type="image/x-icon">

<!--Basic Styles-->
<link
	href="<%=request.getContextPath()%>/commonadmin/assets/css/bootstrap.min.css"
	rel="stylesheet" />
<link id="bootstrap-rtl-link" href="" rel="stylesheet" />
<link
	href="<%=request.getContextPath()%>/commonadmin/assets/css/font-awesome.min.css"
	rel="stylesheet" />

<!--Fonts-->
<link
	href="<%=request.getContextPath()%>/commonadmin/js/font-useso.js"
	rel="stylesheet" type="text/css">

<!--Beyond styles-->
<link
	href="<%=request.getContextPath()%>/commonadmin/assets/css/beyond.min.css"
	rel="stylesheet" />
<link
	href="<%=request.getContextPath()%>/commonadmin/assets/css/demo.min.css"
	rel="stylesheet" />
<link
	href="<%=request.getContextPath()%>/commonadmin/assets/css/animate.min.css"
	rel="stylesheet" />
<link id="skin-link" href="" rel="stylesheet" type="text/css" />

<!--Skin Script: Place this script in head to load scripts for skins and rtl support-->
<script src="<%=request.getContextPath()%>/commonadmin/assets/js/skins.min.js"></script>
<script src="<%=request.getContextPath()%>/commonadmin/assets/js/jquery-2.0.3.min.js"></script>
</head>

<!--Head Ends-->
<!--Body-->
<body>
	<form id="teaForm" action="<%=request.getContextPath()%>/admin/user/teaRevise.htm" method="post"
		name="teaForm">
		<input type="hidden" value="${tea.user_id }" name="user_id" />
		<div class="register-container animated fadeInDown">
			<div class="registerbox bg-white">
				<div class="registerbox-caption "></div>

				<div class="registerbox-title" style="text-align: center;">教师信息修改</div>
				<div class="registerbox-caption "></div>
				
				<div class="registerbox-textbox">
				<font style="font-weight:bold">手机号码:</font>
					<input type="text" class="form-control"
						value="${tea.user_telephone }" required name="user_telephone" placeholder="手机号码:" />
				</div>
				
				<div class="registerbox-textbox">
				<font style="font-weight:bold">邮箱:</font>
					<input type="text" class="form-control"
						value="${tea.user_email }" required name="user_email" placeholder="邮箱:" />
				</div>
				
				<div class="registerbox-textbox">
				<font style="font-weight:bold">个人介绍:</font>
					<textarea class="form-control"
						 required name="teacher_introduce" placeholder="个人介绍:" >${tea.teacher_introduce }
						</textarea>
				</div>
				
				<div class="registerbox-textbox">
				<font style="font-weight:bold">学校:</font>
					<select id="user_school" class="user_school" name="user_school" > 
					</select>
				</div>
				
				<div class="registerbox-textbox">
				<font style="font-weight:bold">工号:</font>
					<input type="text" class="form-control"
						value="${tea.user_student_id }" required name="user_student_id" placeholder="工号:" />
				</div>
				
				<div class="registerbox-textbox">
				<font style="font-weight:bold">工资$/Hour:</font>
					<input type="text" class="form-control"
						value="${tea.teacher_wage }" required name="teacher_wage" placeholder="工资:" />
				</div>
				
				<div class="registerbox-textbox">
				<font style="font-weight:bold">经验:</font>
					<input type="text" class="form-control"
						value="${tea.teacher_experience }" required name="teacher_experience" placeholder="经验:" />
				</div>
				
				<div class="registerbox-textbox">
				<font style="font-weight:bold">PT值:</font>
					<input type="text" class="form-control"
						value="${tea.teacher_pt }" required name="teacher_pt" placeholder="PT值:" />
				</div>
				
				<div class="registerbox-textbox">
				<font style="font-weight:bold">MR值:</font>
					<input type="text" class="form-control"
						value="${tea.teacher_mr }" required name="teacher_mr" placeholder="MR值:" />
				</div>
				
				<div class="registerbox-textbox">
				<font  style="font-weight:bold">首页优先级:(越高越靠前)</font>
					<select class="user_recommend_index" name="user_recommend_index" > 
						<option value="1">1级</option>
						<option value="2">2级</option>
						<option value="3">3级</option>
						<option value="4">4级</option>
						<option value="5">5级</option>
					</select>
				</div>
				
				<div class="registerbox-textbox">
				<font style="font-weight:bold">级别:</font>
					<input type="text" class="form-control"
						value="${tea.teacher_level }" required name="teacher_level" placeholder="级别:" />
				</div>
				
				<div class="registerbox-textbox">
				<font style="font-weight:bold">系别:</font>
					<input type="text" class="form-control"
						value="${tea.teacher_department }" required name="teacher_department" placeholder="系别:" />
				</div>
				
				<div class="registerbox-textbox">
				<font style="font-weight:bold">认证的课程:</font>
					<input type="checkbox" name=""></>
					<input type="text" class="form-control"
						value="${tea.teacher_course }" required name="teacher_course" placeholder="学院:" />
				</div>
				
				<div class="registerbox-textbox">
				<div class="mes_pepole_list">
					<div class="mes_add_pepole" id="addPepole">
						<span class="glyphicon glyphicon-plus-sign"></span> 添加收信人
					</div>
					<ul id="pepoleList">
	
					</ul>
				</div>
				
				</div>
				
				
				<div class="registerbox-textbox">
				<font style="font-weight:bold">PT/MR显示:</font>
					<select class="teacher_pt_mr_type" name="teacher_pt_mr_type" > 
						<option value="0">关</option>
						<option value="1">开</option>
					</select>
				</div>
				
				<div class="registerbox-textbox">
				<font style="font-weight:bold">Level显示:</font>
					<select class="teacher_level_type" name="teacher_level_type" > 
						<option value="0">关</option>
						<option value="1">开</option>
					</select>
				</div>
				
				<div class="registerbox-textbox">
				<font style="font-weight:bold">用户冻结状态:</font>
					<select class="user_lock" name="user_lock" > 
						<option value="0">正常</option>
						<option value="1">冻结</option>
					</select>
				</div>
				
				<div class="registerbox-textbox">
				<font style="font-weight:bold">被推荐状态:</font>
					<select class="teacher_recommend" name="teacher_recommend" > 
						<option value="0">不推荐</option>
						<option value="1">推荐</option>
					</select>
				</div>
				
				<div class="registerbox-submit">
					<input type="submit" class="btn btn-primary pull-left" value="修改" >
				</div>
				<div class="registerbox-submit">
					<input type="button" class="btn btn-primary pull-right" value="关闭"
						onclick="window.close()">
				</div>
			</div>
		</div>
	</form>
	
	<div class="fileterBg"></div>
	
	<script type="text/javascript">
	$.ajax({
				type:"get",
				url:"<%=request.getContextPath()%>/app/user/school.htm",
				data:{
				},
				async:false,
				success:function(data){
					s = data.data.school;
					school_list_html = "";
					for(var i = 0; i < s.length; i++){
						school_list_html = school_list_html
						+ '<option value="'+ s[i].school_name
						+ '">'+ s[i].school_name +'</option>';
					};
					$("#user_school").html(school_list_html);
				},
				error:function(){
					alert('获取学校列表失败');
				}
	});
					
					$(".user_school").val('${tea.user_school}'); 
					$(".teacher_level_type").val(${tea.teacher_level_type}); 
					$(".teacher_pt_mr_type").val(${tea.teacher_pt_mr_type}); 
					$(".user_recommend_index").val('${tea.user_recommend_index}'); 
					$(".user_lock").val('${tea.user_lock}'); 
					$(".teacher_recommend").val('${tea.teacher_recommend}'); 

		
	</script>
	<!--Basic Scripts-->
	<script
		src="<%=request.getContextPath()%>/commonadmin/assets/js/jquery-2.0.3.min.js"></script>
	<script
		src="<%=request.getContextPath()%>/commonadmin/assets/js/bootstrap.min.js"></script>

	<!--Beyond Scripts-->
	<script
		src="<%=request.getContextPath()%>/commonadmin/assets/js/beyond.min.js"></script>
		
		
		
		
		<div class="add_msg_list" style="display: block;">
		<div class="close" id="msgClose">x</div>
		<div style="margin-left: 12px; margin-top: 12px; color: #333">选择收信人</div>
		<div class="selectbox">
			<div id="searchable_filter" class="dataTables_filter">
				<label><input type="search" class="form-control input-sm" aria-controls="searchable" id="sel_keyWords"></label>
			</div>
			<div class="selectboxtype">
				<ul>
					<li><span class="glyphicon glyphicon-stop"></span>学生</li>
					<li><span class="glyphicon glyphicon-stop"></span>老师</li>
					<li><span class="glyphicon glyphicon-stop"></span>活动</li>
					<li><span class="glyphicon glyphicon-stop"></span>账户里没有发过160元优惠券且未下过单的学生</li>
				</ul>
			</div>

			<div style="clear: both"></div>
			<div class="select-bar">
				<select multiple="multiple" id="select1">
					<!--  <option value="老师--183--常美英--13301028154">老师--183--常美英--13301028154</option>-->
				</select>
			</div>

			<div class="btn-bar">
				<p>
					<span id="add"><input type="button" class="btn" value=">" title="移动选择项到右侧"></span>
				</p>
				<p>
					<span id="add_all"><input type="button" class="btn" value=">>" title="全部移到右侧"></span>
				</p>
				<p>
					<span id="remove"><input type="button" class="btn" value="<" title=" 移动选择项到左侧"></span>
				</p>
				<p>
					<span id="remove_all"><input type="button" class="btn" value="<<" title=" 全部移到左侧"></span>
				</p>
			</div>

			<div class="select-bar">
				<select multiple="multiple" id="select2"></select>
			</div>
		</div>

		<div class="newAdminBtton" style="margin: 0 auto" id="selectButton">确定</div>
		<div style="text-align: center;"></div>

	</div>
	
	<script>
	$("#msgClose").on("click",function(){
        	$(".fileterBg").hide();
        	$(".add_msg_list").hide();
        	$("#select2 option").remove();
        });
        $("#addPepole").on("click",function(){
        	$(".fileterBg").show();
        	$(".add_msg_list").show();
        });
        $(".fileterBg").on("click",function(){
        	$(this).hide();
        	$(".add_msg_list").hide();
        	$(".seek_msg_list").hide();
        	$("#select2 option").remove();
        });
        
        $("#msgClose1").on("click",function(){
        	$(".fileterBg").hide();
        	$(".seek_msg_list").hide();
        	$("#select2 option").remove();
        });      
        $("#selectButtonClose").on("click",function(){
        	$(".fileterBg").hide();
        	$(".seek_msg_list").hide();
        });   
        $(".seekDetail").on("click",function(){
        	$("#msg_detail li").remove();	
        	$(".fileterBg").show();
        	$(".seek_msg_list").show();
        	var sms_id=$(this).attr("id");
        	$.ajax({
			    type: 'post',
			    url: '/admin/SMS/getSMSDetail.htm?msg_id=' + sms_id,
			    data:'',//传给后台的数据，多个参数用&连接
			    dataType: 'JSON',
			    cache:false,
			    beforeSend:function(){
			    	 //这里是开始执行方法，显示效果，效果自己写
			    	 var list=$('<li class="msgLoding">' + '<img src="/common/img/loading.gif">' + '</li>')
						list.appendTo("#msg_detail");
			    	 },
			    	 complete:function(){
			    	 //方法执行完毕，效果自己可以关闭，或者隐藏效果
			    	 
			    		
			    	 },
			    success: function(msg){
			    	$("#msg_detail li.msgLoding").remove();
				    console.log(msg);
				    	var detailList=msg.data.detailList;
				    	for(var i=0;i<detailList.length;i++){
				    		var phone=detailList[i].phone;
				    		var detail=detailList[i].detail;
				    		var description=detailList[i].description;
				    		var j=i+1;
				    		var list=$(
				    			'<li>' + '<span class="numberWrap">' + j + '</span>' + detail + '---' + phone + '(' + description + ')' + '</li>'
				    		)
				    		list.appendTo($("#msg_detail"));
				    }
			    }
			    	
 			})
        });
        
        //搜索
        var element = document.getElementById("sel_keyWords");
        if("\v"=="v") { 
			element.onpropertychange = selectFn; 
		}else{ 
			element.addEventListener("input",selectFn,false); 
		} 
        function selectFn(){
        	var user_type='';
        	$(".selectboxtype li").each(function(){
        		if($(this).hasClass("on")){
        			user_type=$(this).index();
        		}
        	})
        	var sel_keyWords=$("#sel_keyWords").val();
        	if(user_type.length==0){
        		return;
        	}else{
	 			$.ajax({
				    type: 'post',
				    url: "/admin/SMS/getReceivers.htm",
				    data:{"user_type":user_type,"keywords":sel_keyWords},//传给后台的数据，多个参数用&连接
				    dataType: 'JSON',
				    cache:false,
				    success: function(msg){
				    	$("#select1 option").remove();
				    	console.log(msg);
				    	var receivers=msg.data.receivers;
				    	for(var i=0;i<receivers.length;i++){
				    		var realname=receivers[i].realname;//
				    		var telephone=receivers[i].telephone;
				    		var user_id=receivers[i].user_id;
				    		var user_type=receivers[i].user_type;
				    		var username=receivers[i].username;
				    		if(user_type==0){
				    			user_type="学生";
				    		}else if(user_type==1){
				    			user_type="老师";
				    		}else if(user_type==2){
				    			user_type="活动"
				    		}else if(user_type==3){
				    			user_type="账户里没有发过160元优惠券且未下过单的用户"
				    		}
				    		var list=$(
				    			'<option value="">' + user_type + '--' + user_id + '--' + username + '--' + telephone + '</option>'
				    		)
				    		list.appendTo($("#select1"));
				    	}
				    }
	 			})
        	}
        }
        //学生，老师，活动筛选
        $(".selectboxtype li").on("click",function(){
        	$(this).siblings().removeClass("on");
        	$(this).addClass("on");
        	var user_type=($(this).index());
     		var sel_keyWords=$("#sel_keyWords").val();
 			$.ajax({
			    type: 'post',
			    url: "/admin/SMS/getReceivers.htm?user_type=" + user_type + "&keywords=" + sel_keyWords,
			    data:'',//传给后台的数据，多个参数用&连接
			    dataType: 'JSON',
			    cache:false,
			    success: function(msg){
			    	$("#select1 option").remove();
			    	console.log(msg);
			    	var receivers=msg.data.receivers;
			    	for(var i=0;i<receivers.length;i++){
			    		var realname=receivers[i].realname;//
			    		var telephone=receivers[i].telephone;
			    		var user_id=receivers[i].user_id;
			    		var user_type=receivers[i].user_type;
			    		var username=receivers[i].username;
			    		if(user_type==0){
			    			user_type="学生";
			    		}else if(user_type==1){
			    			user_type="老师";
			    		}else if(user_type==2){
			    			user_type="活动"
			    		}
			    		var list=$(
			    			'<option value="">' + user_type + '--' + user_id + '--' + username + '--' + telephone + '</option>'
			    		)
			    		list.appendTo($("#select1"));
			    	}
			    }
 			})
 			
        })
        
        //生成可发送列表
        $("#selectButton").on("click",function(){
        	if($("#select2 option").size()==0){
        		alert("请选择")
        		return;
        	}
        	var arr=[];
        	$(".fileterBg").hide();
        	$(".add_msg_list").hide();
        	$("#select2 option").each(function(){
        		arr.push($(this).text())
        	})
        	
        	var lists='';
        	for(var i=0;i<arr.length;i++){
        		var list=$(
        			'<li>' + arr[i] + '<span class="glyphicon glyphicon-minus-sign">' + '</span>' + '</li>'
        		)
        		list.appendTo($("#pepoleList"));
        	}
        	
        	
        	
        	 $("#pepoleList span").on("click",function(){
             	$(this).parent().remove();
             })
             $("#select2 option").remove();
        })
	
	</script>
</body>
<!--Body Ends-->
</html>
